package com.example.taobaounion.utils

import android.util.Log

/**
 *@author : Administrator
 *@descreption : Log工具
 * 可以通过控制currentLev来显示哪些级别的log
 * 或者全部不显示
 */
object LogUtil {
    var currentLev = 4
    private const val DEBUG_LEV = 1
    private const val INFO_LEV = 2
    private const val WARNING_LEV = 3
    private const val ERROR_LEV = 4


    fun <T : Any> d(tag: Class<T>, log: String) {
        if (currentLev >= DEBUG_LEV) {
            Log.d(tag.simpleName, "huge  $log");
        }
    }

    fun i(tag: String, log: String) {
        if (currentLev >= INFO_LEV) {
            Log.i(tag.javaClass.simpleName, "huge  $log");
        }
    }

    fun w(tag: String, log: String) {
        if (currentLev >= WARNING_LEV) {
            Log.w(tag.javaClass.simpleName, "huge  $log");
        }
    }

    fun e(tag: String, log: String) {
        if (currentLev >= ERROR_LEV) {
            Log.e(tag.javaClass.simpleName, "huge  $log");
        }
    }


}


